package warmachineroster.presentation.command;

import org.eclipse.gef.commands.Command;

import warmachineroster.WarcasterRosterElement;
import warmachineroster.WarjackRosterElement;

public class WarjackRosterElementMoveCommand extends Command {

	private int newIndex;
	private int oldIndex;
	private WarjackRosterElement warjackRosterElement;
	private WarcasterRosterElement warcasterRosterElement;

	public void setNewIndex(int newIndex) {
		this.newIndex = newIndex;
	}

	public void setOldIndex(int oldIndex) {
		this.oldIndex = oldIndex;

	}

	public void setWarjackRosterElement(WarjackRosterElement childModel) {
		this.warjackRosterElement = childModel;
	}

	public void setWarcasterRosterElement(
			WarcasterRosterElement warcasterRosterElement) {
		this.warcasterRosterElement = warcasterRosterElement;
	}

	@Override
	public void execute() {
		warcasterRosterElement.getBattlegroup().remove(warjackRosterElement);
		warcasterRosterElement.getBattlegroup().add(newIndex, warjackRosterElement);
	}

	@Override
	public void undo() {
		warcasterRosterElement.getBattlegroup().remove(warjackRosterElement);
		warcasterRosterElement.getBattlegroup().add(oldIndex, warjackRosterElement);
	}

	
	
}
